UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1gHnsRwFmOiYkrmx6e4HFmIj2i9zEmlxmWK9l2itlEA='
WHERE
key_id = 'daaa387ff6927dee7f261089547e20d6bab0bb2cdcb73087d38b07777e5a2045'
AND (
token = '1gHnsRwFmOiYkrmx6e4HFmIj2i9zEmlxmWK9l2itlEA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)