UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vgZxhyAzqA+cWazUHq5+uS+YlVLXRXDL35SiwKJjgTg='
WHERE
key_id = '31b711142d66830bef8bd520850d9c8a18549b0312086b3f1f9ed37eb0eb0ca6'
AND (
token = 'vgZxhyAzqA+cWazUHq5+uS+YlVLXRXDL35SiwKJjgTg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)