UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wRquvukYuvZrfF5OlNusCFRsNc6pdPqqUtP72vS5kio=' 
WHERE 
  key_id = 'f772c9f4b44ddf4cc2784f6e99d4b8cf71f91240791c67386198cdead6ea9375' 
  AND (
    token = 'wRquvukYuvZrfF5OlNusCFRsNc6pdPqqUtP72vS5kio=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027