UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jwOonINOAvQOChnC0Snrdy3ptfo4JTLVZkeAKhG2wJA='
WHERE
key_id = 'b06d13322b911962d58bed4557e019a5a6ede4438cb367055fb17db786b8ab5d'
AND (
token = 'jwOonINOAvQOChnC0Snrdy3ptfo4JTLVZkeAKhG2wJA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)