UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F8J5Lo06SF8AqNEqvCpAFGBihrAtEuMIha9IH1gVAYY=' 
WHERE 
  key_id = 'cd5a3a0a4bd88af381e048efd60ba01fec21ae6bc3d9f158f86d343a20964f2f' 
  AND (
    token = 'F8J5Lo06SF8AqNEqvCpAFGBihrAtEuMIha9IH1gVAYY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017