UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xbSdI5SORjV7Jz1EoJk/V6qXgow1TE10kcN3XIeYa3c='
WHERE
key_id = 'b802ce2e315756de277c4391f1d83075f324e3b6cb321222b08b22e80e5ea697'
AND (
token = 'xbSdI5SORjV7Jz1EoJk/V6qXgow1TE10kcN3XIeYa3c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)