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