UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7n+IZlycwBVIwtjRsU7uP2s8px7nsCtOrsbFAp7868U=' 
WHERE 
  key_id = 'd8f4f54f2eff04ba21531817445f917f0bf991afc7209f818208ce7590ace776' 
  AND (
    token = '7n+IZlycwBVIwtjRsU7uP2s8px7nsCtOrsbFAp7868U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028