UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qn0jbfgGDBDFaHzj5O5i+RjMXPiUzRznKI6OgFzIeX8=' 
WHERE 
  key_id = '9f499b274ac8d7fc0018a7185d6baa91c35b6f673fa8183daf860c7bb4da6295' 
  AND (
    token = 'qn0jbfgGDBDFaHzj5O5i+RjMXPiUzRznKI6OgFzIeX8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030