UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rQKIhh/6+fpbwrd6Bu4mVrYUmYZibuOUyfNEMVELZQA='
WHERE
key_id = 'f6e7c5dc1207c8f17249828f3c9ac7870010838f2be58756de9409608eb11c1e'
AND (
token = 'rQKIhh/6+fpbwrd6Bu4mVrYUmYZibuOUyfNEMVELZQA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)