UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CJa8UBoOPGtQyWkJt1IUxfo+AzFwtcb63qIr4I4zqSc='
WHERE
key_id = 'c585754dcd411f9b062039bd1a4b8181eb8657c7468a272c73f9f910e81e6557'
AND (
token = 'CJa8UBoOPGtQyWkJt1IUxfo+AzFwtcb63qIr4I4zqSc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)