UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KfgM51xUD6CtYZMd9o72Y2Coj/dDwQBmlAeRH/Gfdws=' 
WHERE 
  key_id = 'd52d7426314fa3730260066a38582e6aadad20647d77bd2d4c50515f76b00eeb' 
  AND (
    token = 'KfgM51xUD6CtYZMd9o72Y2Coj/dDwQBmlAeRH/Gfdws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029