UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TFgeu3i/8jjE++cIYcbHKVIvxnRnCI5m/AwPCI3N7zo=' 
WHERE 
  key_id = '542c0766f9d9e802e51edcd63a966b07a7b99d49947150e3bb7cab7b0e66c2ed' 
  AND (
    token = 'TFgeu3i/8jjE++cIYcbHKVIvxnRnCI5m/AwPCI3N7zo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052