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