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