UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gAFi4fFfYe6UrVuiiZ7PBZsw0kwkcl89FNh6q9EVVOA=' 
WHERE 
  key_id = '95f8020a8f063c8661cde034238d477f4371b811aed90a810626b07792a6723b' 
  AND (
    token = 'gAFi4fFfYe6UrVuiiZ7PBZsw0kwkcl89FNh6q9EVVOA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032