UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LL0OVXBGMLrwE7nveC0MHDWItRY15RVtYw6WLD1oWOc=' 
WHERE 
  key_id = '791d18e524bd8905f68b61fe09b24a8aa77ab98fc55d908a9733c9c483d9e898' 
  AND (
    token = 'LL0OVXBGMLrwE7nveC0MHDWItRY15RVtYw6WLD1oWOc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037