UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8dEj7FH2otkMOkX+tV7344gZRUZfVDK3zHAKv02pTJA='
WHERE
key_id = 'c103644ad51796b65f243d04846fefcacd934c932bf96b3f36fabc33b7ee87d3'
AND (
token = '8dEj7FH2otkMOkX+tV7344gZRUZfVDK3zHAKv02pTJA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)