UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KJ4ZBNPLEoitijqJXLaohTT622un+vdo/nsn5aCr25g='
WHERE
key_id = 'bf7c59ac98241e975373525b569b976cf07cd2b7e755627e66717bf49e3ae3e2'
AND (
token = 'KJ4ZBNPLEoitijqJXLaohTT622un+vdo/nsn5aCr25g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)