UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XXRi+tbtcOwrCPY6TwCpKEkv5sijLstbVJGohJbAe2k='
WHERE
key_id = '8f9f89899fed449a1703ac1e8f0476d821c1796c6d0cc1a09a88c281e03796f1'
AND (
token = 'XXRi+tbtcOwrCPY6TwCpKEkv5sijLstbVJGohJbAe2k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)