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

Query time 0.00037