UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O0VLi0cUlyFEY3uUWGIGf+HxzKF0/U1zup8aleE44DU=' 
WHERE 
  key_id = '9077f008b301a3c849c62d43f60f677d6cc8d213b12ad2e76ed47d8f280f9108' 
  AND (
    token = 'O0VLi0cUlyFEY3uUWGIGf+HxzKF0/U1zup8aleE44DU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029