UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q4HhZ8NnObiz240HDKejSgaqBzcxvF+raP4GJ3//vhs='
WHERE
key_id = 'a09fee45a1fa31b4b66d45aa423381adbf5a8b43834e49484f96537cf3fc53c7'
AND (
token = 'Q4HhZ8NnObiz240HDKejSgaqBzcxvF+raP4GJ3//vhs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)