UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '59hI5Bw8N6BuFmU4n7VEp93FxVfvtab1bsCfbhCkX0U='
WHERE
key_id = '1e2c5713a6e31be32171bda72276488980040e18b15e079a89979030bad4112b'
AND (
token = '59hI5Bw8N6BuFmU4n7VEp93FxVfvtab1bsCfbhCkX0U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)