UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'maZ/6mtU/+gpelzmNaWZikm8R1oWVkbODD3wXE6oCyE='
WHERE
key_id = '46e55dfdde9d9369fe0caebdcee73a3027d088148344278bd9ad3d4bacae4fd2'
AND (
token = 'maZ/6mtU/+gpelzmNaWZikm8R1oWVkbODD3wXE6oCyE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)