UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g4nuoXmUEoU/32h4dp65Evim4vgLHgy5edkErDlkXHQ=' 
WHERE 
  key_id = '078d46190aaf177064a7c14441314c330431667b9893d8ac6bd188713273a62c' 
  AND (
    token = 'g4nuoXmUEoU/32h4dp65Evim4vgLHgy5edkErDlkXHQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037