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

Query time 0.00034