UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wXlW99xV7ng8JTCobbWGq3mSCW0RcQ3QkRA02QO0LWU='
WHERE
key_id = '390f60eb219ac803fd86ed44934f282e5075a9c0e53e66d817e0317b8ba21a38'
AND (
token = 'wXlW99xV7ng8JTCobbWGq3mSCW0RcQ3QkRA02QO0LWU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)