UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1+iY2ZwYODLvOjBYyBUjB0fWvHKOoQAqdjD8nIYyd6E=' 
WHERE 
  key_id = '1a9efe7412d436931455bfd592169a1331453b9322a970f36cf93891a3feca6b' 
  AND (
    token = '1+iY2ZwYODLvOjBYyBUjB0fWvHKOoQAqdjD8nIYyd6E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026