UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LBzH5RFRqJEYnZdsCA2pEcEsNLPjNvy3x6Lea9ieFBI=' 
WHERE 
  key_id = '71bcf7256187980985397006653aebc31ae5e987dc085277670d4b1f2d4f7854' 
  AND (
    token = 'LBzH5RFRqJEYnZdsCA2pEcEsNLPjNvy3x6Lea9ieFBI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00137