UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f0cGWa0T3DgtdfOYO67oXhpp/tnhPsa716oTO2dNxvM=' 
WHERE 
  key_id = '5283324da8092c4903cd8b54a91f78a1f17700fca263c00ec627eda4e4d4d699' 
  AND (
    token = 'f0cGWa0T3DgtdfOYO67oXhpp/tnhPsa716oTO2dNxvM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063