UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fT4lJhJHHgwxokrlj2rOnbm014G9s04JJc2pHwMhBuE=' 
WHERE 
  key_id = '8d57fd5aaa143b5b3ab97a92e4d4d14d287d115d93cee43857a79a04257d7fea' 
  AND (
    token = 'fT4lJhJHHgwxokrlj2rOnbm014G9s04JJc2pHwMhBuE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035