UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8Bt4eabeld4bFv2BYxMXTZ5kuZcfQSWJVVZSsbnJdZA='
WHERE
key_id = '9afe8897ef552b1c4c26417e12a55f3dc6cd44a11595b2f929196fa3faa2b0e7'
AND (
token = '8Bt4eabeld4bFv2BYxMXTZ5kuZcfQSWJVVZSsbnJdZA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)