UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P6m9AA3bzoRCMKl8WknuoWTXLyY80JtwRLdk6I3GiT0='
WHERE
key_id = '9910769ee16dcfc2c2ca6d8c1e965b82d8d004771b1244e02376e800e304bcea'
AND (
token = 'P6m9AA3bzoRCMKl8WknuoWTXLyY80JtwRLdk6I3GiT0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)