UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd9zSAAy4FiA51g0hNydgXfwPFmEg5oxf0+G+OnZmBXU='
WHERE
key_id = 'b2b13de9986ae21b2cc1803702883422f0c04409a6384a5e33757506a008fb92'
AND (
token = 'd9zSAAy4FiA51g0hNydgXfwPFmEg5oxf0+G+OnZmBXU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)