UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jm0EQphxHiGhywbHhnSgJosbca42B2zhHes+gPJ/i8g='
WHERE
key_id = 'cf1e337e7cc130295f71e8e6bdb9098de7c96c0610da099cdce6081ffa26a2ee'
AND (
token = 'jm0EQphxHiGhywbHhnSgJosbca42B2zhHes+gPJ/i8g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)