UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eD0/ydIpYaFzDTV3MOyWcRSJvHV/vEPThjDmkjC2JNM=' 
WHERE 
  key_id = '3849b41540ab86691eea982a9007ed746e597dc7f6767b371fde953381b201e8' 
  AND (
    token = 'eD0/ydIpYaFzDTV3MOyWcRSJvHV/vEPThjDmkjC2JNM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042