UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CnBFfgmPuN/ZGT3gcQrKx7YfbB4wzp83Ejmexh5tMP0=' 
WHERE 
  key_id = '402c838383ebce1be171f5045f2a91042566d1cdf106eaddba5c4b0893ff360f' 
  AND (
    token = 'CnBFfgmPuN/ZGT3gcQrKx7YfbB4wzp83Ejmexh5tMP0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025