UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h65fk2bMPa0kR6vUGJ5MyN8Yo+L61q0/e88GXR2o7kE=' 
WHERE 
  key_id = 'f65048d1c98878597978a8fa746e99926cbe134b4d0e37c260c6ce79da5cef71' 
  AND (
    token = 'h65fk2bMPa0kR6vUGJ5MyN8Yo+L61q0/e88GXR2o7kE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027