UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'akV4Fj6oTETqAgKO9yzFloEEiz4gRDXYeSmyre2dXBE=' 
WHERE 
  key_id = '2b5bf4d53e7d76e1050e0a036af1ab136f1c0853c1b15f6ae982bc9377917f78' 
  AND (
    token = 'akV4Fj6oTETqAgKO9yzFloEEiz4gRDXYeSmyre2dXBE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045