UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vvNhyPNQ9Y3+cmZ7PvyPrikb7+xSqYIMu085o3zeBY0='
WHERE
key_id = 'a4a3e0fcd5d4a32a333d5490d24f82e1d821ffb0b6d0b7e016ce1073c9e4a2b1'
AND (
token = 'vvNhyPNQ9Y3+cmZ7PvyPrikb7+xSqYIMu085o3zeBY0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)