UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VG1TnixrkbVyVABQJzzZ7mcDGrp72QrfpAFKPwEdHXU=' 
WHERE 
  key_id = '99da25466486a72481b249246229a5045cc4222f9480045b80e6363d23612906' 
  AND (
    token = 'VG1TnixrkbVyVABQJzzZ7mcDGrp72QrfpAFKPwEdHXU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044