UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iLQGmr5eaBT1yanVibTVOVIlRuPA1Jv9VXf9CrfY5D4='
WHERE
key_id = 'd7f069b557d3369c0d4ca422162772dd1ddea0af3638fabd67c1f16fd0df32dd'
AND (
token = 'iLQGmr5eaBT1yanVibTVOVIlRuPA1Jv9VXf9CrfY5D4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)