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