UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nlGFvzQaIBNNi3QDYhLuLE8k7ET5es3jlcP7Zyy0hX0=' 
WHERE 
  key_id = '402238cb83fd07047e73dbd72d3d51801c6aa9bf1c70f86753c39b67d5b50015' 
  AND (
    token = 'nlGFvzQaIBNNi3QDYhLuLE8k7ET5es3jlcP7Zyy0hX0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025