UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CwiLO7JfxQ+awgzrodId9pPj4NCAPHsD8vdX3Zpshhc='
WHERE
key_id = 'd0bacaf073b0970b979b7423a81a13fbf05fe489f5ebddec65b2503b3f0649af'
AND (
token = 'CwiLO7JfxQ+awgzrodId9pPj4NCAPHsD8vdX3Zpshhc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)