UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HPdRQyqIlqoT+CFolD1fHgGCBzkKydmAPBttUb7B2R4='
WHERE
key_id = 'a81b62f82af7ebdd90b8ea5e349831e49a9c1c13a86b87fa4a5934ee4eb6d690'
AND (
token = 'HPdRQyqIlqoT+CFolD1fHgGCBzkKydmAPBttUb7B2R4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)