UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FB+B5NiT8WcV6YwMKVB9TNEG3amfVjMwKNsXqDd3H48='
WHERE
key_id = 'a40e31d2127be8aebb1df3e2f457a2a91e8bc01986cdec878f3fe888093eebe2'
AND (
token = 'FB+B5NiT8WcV6YwMKVB9TNEG3amfVjMwKNsXqDd3H48='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)