UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '97Jz96Q6vsdA20saWSyNsiW776Ox8dC9Poexzh/xtTg=' 
WHERE 
  key_id = '02cbc5b9f0b4a66f05d3d065fb05e0104b1152be85501a7248e720ac508f6175' 
  AND (
    token = '97Jz96Q6vsdA20saWSyNsiW776Ox8dC9Poexzh/xtTg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026