UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'thqlroPPEvkPwGsqEeEPfaQTN66Kgo+YVeedOoODcSM='
WHERE
key_id = 'b763ecd9218d9dfc7e8517a46fad32d28da7b248af2b8e243c37f156d08b1705'
AND (
token = 'thqlroPPEvkPwGsqEeEPfaQTN66Kgo+YVeedOoODcSM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)