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

Query time 0.00018