UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wvGk3cXPGMoK1zO544Juso3b9jzmMRe6BczfjPP0o8g=' 
WHERE 
  key_id = 'efaf92a142f6232201da36ea231acd8f4235053d2c0a8566dac093b023c401ab' 
  AND (
    token = 'wvGk3cXPGMoK1zO544Juso3b9jzmMRe6BczfjPP0o8g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023