UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yD80xGmjpbC5L+Zbjl62qzviSmnVrS0zFD/iMta+Trk=' 
WHERE 
  key_id = 'd5bce328049f18e9dbc17ecff5bc9977122a10da75de146c185e7cfab1c4c54e' 
  AND (
    token = 'yD80xGmjpbC5L+Zbjl62qzviSmnVrS0zFD/iMta+Trk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050