UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YgM4hpyCuxLvWAhZeCNa1467awWGowgHf15gtCe49co='
WHERE
key_id = '3721d47f6c2b221a862a234ef43215047d20fada570e8746f04eaef26da7e330'
AND (
token = 'YgM4hpyCuxLvWAhZeCNa1467awWGowgHf15gtCe49co='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)