UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pLttyfzxiWmQOfNw2ZMkHabrY010cyHNj7dzSU0Tbo4=' 
WHERE 
  key_id = '6bfb0be0fddc7b6055e59b9e62c8d956e1d112b94ba935afc63496781ec8a9db' 
  AND (
    token = 'pLttyfzxiWmQOfNw2ZMkHabrY010cyHNj7dzSU0Tbo4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025