UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PvJ06NCux8iAU/ihltK8viUiJzCRbCpIPXXdeuxK52s=' 
WHERE 
  key_id = '8770a89445c717a1a304c2534f44ac7407a91a521f9805972d4fac63ad78c3b3' 
  AND (
    token = 'PvJ06NCux8iAU/ihltK8viUiJzCRbCpIPXXdeuxK52s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063