UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hF1KkLXec4DIsqu5fEkksfCz+Dz5O91lpqRhdyCxP6c=' 
WHERE 
  key_id = '51b401b0068208b3c1ac90e8cb822a1716a4bfe273e2e66d86b75d49c7904ac8' 
  AND (
    token = 'hF1KkLXec4DIsqu5fEkksfCz+Dz5O91lpqRhdyCxP6c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042